/*
 * Interface gráfica para a listagem de turmas.
 */
package amanda_gabriel_isabella_lucivania_monica.View;

/**
 * Interface gráfica de listar turma
 *
 * @author lucy
 */
public class ListarTurmaIG extends javax.swing.JFrame {

    /**
     * Cria um novo form ListarTurmaIG
     */
    public ListarTurmaIG() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        amanda_gabriel_isabella_lucivania_monicaPUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("amanda_gabriel_isabella_lucivania_monicaPU").createEntityManager();
        turmaQuery = java.beans.Beans.isDesignTime() ? null : amanda_gabriel_isabella_lucivania_monicaPUEntityManager.createQuery("SELECT t FROM Turma t");
        turmaList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : turmaQuery.getResultList();
        jPPainelListarTurma = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jLListarTurma = new javax.swing.JList();
        jBCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Lista de Turmas Cadastradas");

        jPPainelListarTurma.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista das turmas cadastradas:"));

        org.jdesktop.swingbinding.JListBinding jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, turmaList, jLListarTurma);
        bindingGroup.addBinding(jListBinding);

        jScrollPane1.setViewportView(jLListarTurma);

        javax.swing.GroupLayout jPPainelListarTurmaLayout = new javax.swing.GroupLayout(jPPainelListarTurma);
        jPPainelListarTurma.setLayout(jPPainelListarTurmaLayout);
        jPPainelListarTurmaLayout.setHorizontalGroup(
            jPPainelListarTurmaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPPainelListarTurmaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(43, Short.MAX_VALUE))
        );
        jPPainelListarTurmaLayout.setVerticalGroup(
            jPPainelListarTurmaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPPainelListarTurmaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jBCancelar.setText("Cancelar");
        jBCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPPainelListarTurma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(28, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jBCancelar)
                        .addGap(25, 25, 25))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPPainelListarTurma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(jBCancelar)
                .addContainerGap(23, Short.MAX_VALUE))
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCancelarActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jBCancelarActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.persistence.EntityManager amanda_gabriel_isabella_lucivania_monicaPUEntityManager;
    private javax.swing.JButton jBCancelar;
    private javax.swing.JList jLListarTurma;
    private javax.swing.JPanel jPPainelListarTurma;
    private javax.swing.JScrollPane jScrollPane1;
    private java.util.List<amanda_gabriel_isabella_lucivania_monica.Model.Pojo.Turma> turmaList;
    private javax.persistence.Query turmaQuery;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
